package com.springcloud.eshop.inventory.controller;

import com.springcloud.eshop.inventory.entity.ProductInventory;
import com.springcloud.eshop.inventory.service.ProductInventoryService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (ProductInventory)表控制层
 *
 * @author makejava
 * @since 2020-06-29 06:33:23
 */
@RestController
@RequestMapping("productInventory")
public class ProductInventoryController {
    /**
     * 服务对象
     */
    @Resource
    private ProductInventoryService productInventoryService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public ProductInventory selectOne(Long id) {
        return this.productInventoryService.queryById(id);
    }

    @GetMapping("/insert")
    public ProductInventory insert(ProductInventory brand) {
        return this.productInventoryService.insert(brand);
    }

    @GetMapping("/update")
    public ProductInventory update(ProductInventory brand) {
        return this.productInventoryService.update(brand);
    }

    @GetMapping("/delete")
    public boolean deleteById(long id) {
        return this.productInventoryService.deleteById(id);
    }

}